<?php
    include 'admin_logueado.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		
		<title>Propiedad</title>
		
		<link rel="shortcut icon" href="img/favicon.ico" type="image/x-ico"/>
		
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
		
		<!-- Bootstrap -->
		<link href="librerias/css/bootstrap.min.css" rel="stylesheet" media="screen"/>
		
		
		<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" type="text/css"/>
		<link rel="stylesheet" href="/resources/demos/style.css" type="text/css"/>
		
		<script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>
		<script src="librerias/js/bootstrap.min.js" type="text/javascript"></script>
		<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js" type="text/javascript"></script>
		
		<script src="js/cookies.js" type="text/javascript"></script>
                <script src="js/propiedad_php_1.js" type="text/javascript"></script>
		
		
		
		<link rel="stylesheet" type="text/css" href="css/ajustes.css" />  <!-- CUIDADO CON ESTE -->
		
		<link rel="stylesheet" type="text/css" href="css/cambiando_estilo.css" />  <!-- CUIDADO CON ESTE -->
		
		<script src="js/chequear_estilo.js" type="text/javascript"></script>
		
		<link rel="stylesheet" href="librerias/source/jquery.fancybox.css?v=2.1.4" type="text/css" media="screen" />
		<script type="text/javascript" src="librerias/source/jquery.fancybox.pack.js?v=2.1.4"></script>
		
		
		<!-- Opcional: Incorporar los plugins de JavaScript de Bootstrap -->
		
		<link rel="stylesheet" href="librerias/source/helpers/jquery.fancybox-buttons.css?v=1.0.5" type="text/css" media="screen" />
		<script type="text/javascript" src="librerias/source/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>
		<script type="text/javascript" src="librerias/source/helpers/jquery.fancybox-media.js?v=1.0.5"></script>

		<link rel="stylesheet" href="librerias/source/helpers/jquery.fancybox-thumbs.css?v=1.0.7" type="text/css" media="screen" />
		<script type="text/javascript" src="librerias/source/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>
		
		<link rel="stylesheet" type="text/css" href="css/estilo1.css" id="css_que_cambia"/>
                
                <link rel="stylesheet" type="text/css" href="css/css_php_propiedad.php"/>
	</head>

	<body>
            
            <!--=========== para el me gusta, dejarlo aca??? ================-->
            <div id="fb-root"></div>
        <script type="text/javascript">(function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/es_LA/all.js#xfbml=1";
        fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));</script>
            
            
		<!--=========== BOTONES DE CAMBIO DE ESTILO ================-->
		<div class="row-fluid">
                    <div class="span12">
				<?php 
                                if(admin_logueado()){
                                   $url_actual_1 = $_SERVER['REQUEST_URI'];
                                   $amp1="&";
                                   $amp2="&amp;";
                                   $url_actual = str_replace($amp1, $amp2, $url_actual_1);
                                   
                                   echo "<div id='link_logout'><a href='logout.php?url=$url_actual'>logout</a></div>";
                                }
                            ?>
                        <!--form-->
                        <div id="radio">
                            <input type="radio" id="radio1" name="radio" onclick="cambiarCss1()"/>
                            <label for="radio1" id="label1">Style 1</label>
                            <input type="radio" id="radio2" name="radio" onclick="cambiarCss2()"/>
                            <label for="radio2" id="label2">Style 2</label>
                        </div>
                        <!--/form-->
                                                                
                    </div>
		</div>
		<!--=========== ENCABEZADO ================-->
		<div class="container">
		<div class="row-fluid">
		
			<div class="span12 barra_s ">
				<!-- logo-->
				<div class="span4 well logo_s">
					<img id="logo_img" src="img/LOGO1ELI.png" alt="logo"/>
				</div>
				<!-- botones -->
				<div class="span8 well botones_s">
					<ul class="lista_botones">
						<li class="boton_l"><a href="autores.php" class="links" >Autores</a></li>
						<li class="boton_l" id="boton_readme"><a href="readme.php" class="links">Readme</a></li>
					</ul>
				</div>
			</div>
		</div>
		<!--=========== BREADCRUMB ================-->
		<div class="row-fluid">
			<div class="span12">
				<ul class="breadcrumb">
					<li><a href="index.php" class="breadcrumb_link">Home</a> <span class="divider">/</span></li>
				</ul>
			</div>
		</div>
		<!--=========== CUERPO ================-->
                <?php
                    $id=$_GET["id_propiedad"];
                            //$base=new SQLite3('em_bd.sqlite', 0666); 
                            include_once 'conectar_bd.php';
                            $base=  conectar_solo_lectura();

                                                //$query = "SELECT id_propiedad, id_categoria, id_operacion, precio, direccion, dormitorios, antiguedad, descripcion, img1_path FROM propiedades";
                            $query = "SELECT * FROM propiedades NATURAL JOIN categorias NATURAL JOIN operaciones where id_propiedad=$id";
                            $results = $base->query($query);
                            $arr = $results->fetchArray();

                            $id_cat = $arr['nombre_categoria'];
                            $id_operacion = $arr['nombre_operacion'];
                            $precio = $arr['precio'];
                            $dir = $arr['direccion'];
                            $dormitorios = $arr['dormitorios'];
                            $antig =$arr['antiguedad'];
                            $descr =$arr['descripcion'];
                            $path =$arr['img1_path'];
                            

                echo "<div class='row-fluid'>";
			echo "<div class='span12' id='propiedad_contenedor'>";
				
				//<!--FOTOS-->
				echo "<div class='span5 well izq_prop' id='propiedad_img'>";
					echo "<div id='myCarousel' class='carousel slide'>";
					  	echo "<ol class='carousel-indicators'>";
					    	echo "<li data-target='#myCarousel' data-slide-to='0' class='active'></li>";
					   	echo "<li data-target='#myCarousel' data-slide-to='1'></li>";
					    	echo "<li data-target='#myCarousel' data-slide-to='2'></li>";
					  	echo "</ol>";
					 	 //<!-- Carousel items -->
						echo "<div class='carousel-inner '>";
					    	echo "<div class='item active '>";
					    		echo "<a class='fancybox-thumb' rel='fancybox-thumb' href='img/casa$id/pic1.jpg' title='Galeria imagenes' id='pic_1'>";
									echo "<img id='pic1' class='pic_c' src='img/casa$id/thumbs_m_pic1.jpg' alt='img_propiedad'></img>";	
								echo "</a>";
					    		
					    	echo "</div>";
					    	echo "<div class='item '>";
					    		echo "<a class='fancybox-thumb' rel='fancybox-thumb' href='img/casa$id/pic2.jpg' title='Galeria imagenes' id='pic_2'>";
									echo "<img id='pic2' class='pic_c' src='img/casa$id/thumbs_m_pic2.jpg' alt='img_propiedad'></img>";
								echo "</a>";
					    		
					    	echo "</div>";
					    	echo "<div class='item '>";
					    		echo "<a class='fancybox-thumb' rel='fancybox-thumb' href='img/casa$id/pic3.jpg' title='Galeria imagenes' id='pic_3'>";
									echo "<img id='pic3' class='pic_c' src='img/casa$id/thumbs_m_pic3.jpg' alt='img_propiedad'></img>";
								echo "</a>";
					    	echo "</div>";
						echo "</div>";
					  	// <!-- Carousel nav -->
					  	
					echo "</div>";
                                        $url_actual ="http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
                                        $pedazos=explode('&',$url_actual);
                                        $url_actual= $pedazos[0];
                                        
                                   
                                   
                                        
                                        echo "<div class='fb-comments' data-href='$url_actual' data-width='430' data-num-posts='2'></div>";
				echo "</div>";
				//<!-- INFO -->
				echo "<div class='span5 well medio_prop' id='propiedad_data'>";
					echo "<div id='detalle'>";
						echo "<h2 class='detalle'>Detalle:</h2>";
                                                
                                                echo "<div class='detalle_dato'> <span class='detalle_strong'>categoria: </span>$id_cat</div>";
                                                echo "<div class='detalle_dato'> <span class='detalle_strong'>operacion: </span>$id_operacion</div>";
                                                echo "<div class='detalle_dato'> <span class='detalle_strong'>precio: </span>$precio</div>";
                                                echo "<div class='detalle_dato'> <span class='detalle_strong'>direccion: </span>$dir</div>";
                                                echo "<div class='detalle_dato'> <span class='detalle_strong'>dormitorios: </span>$dormitorios</div>";
                                                echo "<div class='detalle_dato'> <span class='detalle_strong'>antiguedad: </span>$antig</div>";
                                                echo "<div class='detalle_dato'> <span class='detalle_strong'>descripcion: </span>$descr</div>";
                                                
                                                

                                                
					echo "</div>";
				echo "</div>";
				//<!--ESTRELLA-->
				echo "<div class='span2 well der_prop' id='propiedad_fav'>";
					

                                
                                
					echo "<div id='cont_estrella'>";
						echo "<button id='boton_fav' type='button'  onclick='Setear_o_eliminar_favorito()'>";
							echo "<img src='' id='img_favorito' width='90' height='90' alt='estrella'></img>";
						echo "</button>";
						//<!-- form -->
						  echo "<div id='radioN'>";
							echo "<input type='radio' id='radio3' name='radio' onclick='Setear_favorito()'/>";
								echo "<label for='radio3'>";
								echo "</label>";
						  echo "</div>";
						//<!-- /form -->
					echo "</div>";
                                        
                                        echo "<div id='cant_favoritos'>";
                                            //BUSCAR CUANTOS LA ELIGIERON COMO FAVORITOS
                                        
                                         $query_cant_fav = "SELECT Count(id_usuario) FROM favoritos where id_propiedad=$id";
                                         $resultado = $base->query($query_cant_fav);
                                         $arreglo = $resultado->fetchArray();

                                         $cant_favs = $arreglo['Count(id_usuario)'];
                                         echo "$cant_favs";
                                                      echo " usuarios favoritos";
                                                   echo "</div>";
                                        
                                         
                                        echo "<div id='face'>";
                                        
                                            //echo "<div class='fb-like' data-href='http://localhost/Proyecto3/propiedad.php?id_propiedad=1' data-send='true' data-layout='box_count' data-width='450' data-show-faces='true'></div>";
                                        $url_actual_1 ="http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
                                        
                                        $amp1="&";
                                        $amp2="&amp;";
                                        $url_actual = str_replace($amp1, $amp2, $url_actual_1);
                                        
                                        
                                        
                                        echo "<div class='fb-like' data-href='$url_actual' data-send='true' data-layout='box_count' data-width='450' data-show-faces='true'></div>";
                                        
                                        echo "</div>";
                                        
                                        
				echo "</div>";
			echo "</div>";
		echo "</div>";
                ?>
		<!--=========== PIE================-->
		<div class="row-fluid">
			<div class="span12 well pie">
				
					<div class="span2 offset10">
						&copy; IAW 2013
					</div>
					
				
			</div>
		</div>
		
		
		</div> <!-- DIV DE CONTAINER -->
	</body>
</html>
